home *** CD-ROM | disk | FTP | other *** search
/ Utilities Professional 1-1500 / Utilities Professional 1-1500 (1994)(WPD)[!].iso / 12511500 / var1453.dms / var1453.adf / Hardware / Example1.c < prev    next >
C/C++ Source or Header  |  1992-05-01  |  2KB  |  53 lines

  1. /***********************************************************/
  2. /*                                                         */
  3. /* Amiga C Encyclopedia (ACE) V3.0      Amiga C Club (ACC) */
  4. /* -------------------------------      ------------------ */
  5. /*                                                         */
  6. /* Book:    ACM System                  Amiga C Club       */
  7. /* Chapter: Hardware                    Tulevagen 22       */
  8. /* File:    Example1.c                  181 41  LIDINGO    */
  9. /* Author:  Anders Bjerin               SWEDEN             */
  10. /* Date:    92-05-02                                       */
  11. /* Version: 1.00                                           */
  12. /*                                                         */
  13. /*   Copyright 1992, Anders Bjerin - Amiga C Club (ACC)    */
  14. /*                                                         */
  15. /* Registered members may use this program freely in their */
  16. /*     own commercial/noncommercial programs/articles.     */
  17. /*                                                         */
  18. /***********************************************************/
  19.  
  20. /* This fantastic useful program does what all true hackers have     */
  21. /* dreamt of. Enjoy your Amiga's fantastic ability to flash one LED! */
  22.  
  23.  
  24. #include <exec/types.h>
  25. #include <hardware/cia.h>
  26.  
  27.  
  28.  
  29. /* These two structures are defined by the Amiga itself, and  */
  30. /* are automatically connected to the two CIA (8520) chips.   */
  31. extern struct CIA far ciaa;
  32. extern struct CIA far ciab;
  33.  
  34.  
  35.  
  36. /* Declare our function: */
  37. void main();
  38.  
  39. void main()
  40. {
  41.   int loop;
  42.   
  43.   /* Let the disco begin... */
  44.   for( loop = 0; loop < 40000; loop++ )
  45.   {
  46.     /* We change the second bit in the ciapra register. If the bit is */
  47.     /* unset (0) the LED is on, if the bit is set (1) the LED is off. */
  48.     if( loop % 1000 == 0 )
  49.       ciaa.ciapra ^= CIAF_LED;
  50.   }
  51. }
  52.  
  53.